package org.halk.redis.lock.controller;

import lombok.RequiredArgsConstructor;
import org.halk.redis.lock.annotation.RepeatSubmit;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @Author halk
 * @Date 2021/12/23 17:34
 * @desc
 */
@RestController
@RequiredArgsConstructor
public class HelloLockController {

    private final RedissonClient redisson;

    @GetMapping("/hello/{str}")
    @RepeatSubmit
    public String hello(@PathVariable String str) throws InterruptedException {
        return "hello lock :" + "\t" + str;
    }
}
